package com.ssm.security.my;

import com.ssm.security.JWT.JSONResult;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by asd73 on 2017/7/25.
 */
public class SecurityException {
    public void badTokenData(HttpServletRequest request, HttpServletResponse response, IOException failed) throws IOException, ServletException {
        try {
            if(!response.isCommitted()){
                response.setContentType("application/json");
                response.setStatus(HttpServletResponse.SC_OK);
                response.getOutputStream().println(JSONResult.fillResultString(500, failed.getMessage(), null, null,null));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
